#!/bin/bash
# USAGE:
#	exclude 
#	exclude orbitFolder1 orbitFolder2 ...
#
# DESCRIPTION:
#  EXCLUDE is an internal ADORE command. 
#    It shows and creates the list of excluded orbits. 
#
# INPUT:
#  exclude: with no input parameters, currently excluded files are shown.
#  
#  exclude orbitFolder1 orbitFolder2 ...:
#    orbit folders (folders inside data folder) can be specified to be excluded from
#    batch processing.
#
# OUTPUT:
#  exclude: list of excluded orbits.
#  exclude orbitFolder1: will display "Excluding orbitFolder1".
#

if [ "${1:-undefined}" == "undefined" ];then
  if [ -e "${excludesFile}" ]; then
    cat ${excludesFile} | sort | column ;
  else 
    echo "Excludes file does not exist. All orbits will be processed."
    echo "Excludes File: ${excludesFile}"
  fi
else
  local orbit
  for orbit in "$@"
  do
    if [ -d "${dataFolder}/${orbit}" ]; then
      echo "Excluding ${orbit}"
      echo "${orbit}" >> ${excludesFile}
    else
      echo "Can not find ${orbit} in data folder: ${dataFolder}"
      return;
    fi
  done
fi
